package msu.ml.data;

import msu.ml.core.*;
import weka.core.*;

/**
 * A DataProvider provides data in the form of training
 * data and target data. The real utility provided by a 
 * data provider is that different types of experiments
 * can be performed by providing data in certain ways or
 * in a certain order.
 *
 * @author Reginald M Mead
 * @version 1.0
 */
public abstract class DataProvider implements IDataProvider
{

	protected DataCache m_DataCache;

	/**
	 * Create a new data provider
	 */
	public DataProvider()
	{

	}

    public void clearFilters()
    {
    }

    public void reset()
    {
    }

	/**
	 * Creates a new data provider using the specified
	 * data cache.
	 *
	 * @param cache DataCache to use for loading files
	 */
	public DataProvider(DataCache cache)
	{
      m_DataCache = cache;
	}

	/**
	 * Set the DataCache for this Data Provider.
	 *
	 * @param cache the DataCache for this provider to use.
	 */
	public void setDataCache(DataCache cache)
	{
		m_DataCache = cache;
	}

	/**
	 * Get the DataCache being used
	 * by this data provider
	 *
	 * @return the DataCache
	 */
	public DataCache getDataCache()
	{
		return m_DataCache;
	}

    public void addFilter(IDataPreProcessor filter)
    {

    }

	public abstract int count();

	/**
	 * Provides the next group of target data instances.
	 * Unlike the training data which can be aggregated into
	 * one monolythic instances object, the target data
	 * is provides as an array of instances, each representing
	 * a single sweep. In this way the data can be classified
	 * one sweep at a time.
	 *
	 * @return next group of target data instances
	 */
	public abstract NxInstances [] getNextTargetData();

	/**
	 * Provides the next set of training instances in one
	 * large Instances object.
	 *
	 * @return next training data
	 */
	public abstract NxInstances getNextTrainingData();


   /**
    * Get the names of the data sources used in the
    * next set of training data.
    *
    * @return the labels of the next training data
    */
   public abstract String [] getNextTrainingLabels();


	/**
	 * Provides the next set of training instances.
	 *
	 * @return next training data
	 */
	public abstract NxInstances [] getNextIndividualTrainingData();

	/**
	 * Return whether there is more data 
	 *
	 * @return true if more data exists
	 */
	public abstract boolean hasMoreData();

   public void initialize()
   {

   }

}
